﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Liger.Web.Common;
using Liger.Web.Common.Extensions;

namespace Liger.Web.UI
{
    public class DialogBuilder : UIComponentBuilderBase, IHideObjectMembers
    {
        private Dialog Dialog
        {
            get
            {
                return this.Component as Dialog;
            }
        }


        public DialogBuilder()
            : base(new Dialog())
        {

        }

        public DialogBuilder(Dialog Dialog)
            : base(Dialog)
        {

        }

        public DialogBuilder Success(string content)
        { 
            this.Dialog.DialogType = "success";
            this.Dialog.Content = content;
            return this;
        }


        /// <summary>
        /// 设置属性
        /// </summary>
        /// <param name="property"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        public DialogBuilder Set(string property, object value)
        {
            if (this.Dialog.Properties.ContainsKey(property))
            {
                this.Dialog.Properties[property] = value;
            }
            else
            {
                this.Dialog.Properties.Add(property, value);
            }
            return this;
        }

        /// <summary>
        /// 返回ligerDialog的Manager
        /// </summary>
        /// <param name="manager">manager的对象名</param>
        /// <returns></returns>
        public DialogBuilder Manager(string manager)
        {
            this.Dialog.Manager = manager;
            return this;
        }


        public DialogBuilder Cls(string value)
        {
            this.Dialog.Cls = value;
            return this;
        }
        public DialogBuilder Id(string value)
        {
            this.Dialog.Id = value;
            return this;
        }
        public DialogBuilder Buttons(string value)
        {
            this.Dialog.Buttons = value;
            return this;
        }
        public DialogBuilder IsDrag(bool value)
        {
            this.Dialog.IsDrag = value;
            return this;
        }
        public DialogBuilder Width(int value)
        {
            this.Dialog.Width = value;
            return this;
        }
        public DialogBuilder Height(int value)
        {
            this.Dialog.Height = value;
            return this;
        }
        public DialogBuilder Content(string value)
        {
            this.Dialog.Content = value;
            return this;
        }
        public DialogBuilder Target(string value)
        {
            this.Dialog.Target = value;
            return this;
        }
        public DialogBuilder Url(string value)
        {
            this.Dialog.Url = value;
            return this;
        }
        public DialogBuilder Load(bool value)
        {
            this.Dialog.Load = value;
            return this;
        }
        public DialogBuilder Type(string value)
        {
            this.Dialog.Type = value;
            return this;
        }
        public DialogBuilder Left(string value)
        {
            this.Dialog.Left = value;
            return this;
        }
        public DialogBuilder Top(string value)
        {
            this.Dialog.Top = value;
            return this;
        }
        public DialogBuilder Modal(bool value)
        {
            this.Dialog.Modal = value;
            return this;
        }
        public DialogBuilder Name(string value)
        {
            this.Dialog.Name = value;
            return this;
        }
        public DialogBuilder IsResize(bool value)
        {
            this.Dialog.IsResize = value;
            return this;
        }
        public DialogBuilder AllowClose(bool value)
        {
            this.Dialog.AllowClose = value;
            return this;
        }
        public DialogBuilder Opener(string value)
        {
            this.Dialog.Opener = value;
            return this;
        }
        public DialogBuilder TimeParmName(string value)
        {
            this.Dialog.TimeParmName = value;
            return this;
        }
        public DialogBuilder CloseWhenEnter(string value)
        {
            this.Dialog.CloseWhenEnter = value;
            return this;
        }
        public DialogBuilder IsHidden(bool value)
        {
            this.Dialog.IsHidden = value;
            return this;
        }
        public DialogBuilder Show(bool value)
        {
            this.Dialog.Show = value;
            return this;
        }
        public DialogBuilder Title(string value)
        {
            this.Dialog.Title = value;
            return this;
        }
        public DialogBuilder ShowMax(bool value)
        {
            this.Dialog.ShowMax = value;
            return this;
        }
        public DialogBuilder ShowToggle(bool value)
        {
            this.Dialog.ShowToggle = value;
            return this;
        }
        public DialogBuilder ShowMin(bool value)
        {
            this.Dialog.ShowMin = value;
            return this;
        }
        public DialogBuilder Slide(bool value)
        {
            this.Dialog.Slide = value;
            return this;
        }
        public DialogBuilder FixedType(string value)
        {
            this.Dialog.FixedType = value;
            return this;
        }
        public DialogBuilder ShowType(string value)
        {
            this.Dialog.ShowType = value;
            return this;
        }
    }
}